package com.carl.zlds.controller.web;

import com.carl.zlds.tool.common.result.Result;
import com.carl.zlds.annotation.Login;
import com.carl.zlds.pojo.dto.BlackAccountSearchDTO;
import com.carl.zlds.pojo.vo.BlackAccountVO;
import com.carl.zlds.service.IBlackAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author carl
 */
@Slf4j
@RestController(value = "web.blackAccountController")
@RequestMapping("/web/black-account")
@Api(tags = {"客户端 - 黑号管理"})
public class BlackAccountController {

    private final IBlackAccountService blackAccountService;

    @Autowired
    public BlackAccountController(IBlackAccountService blackAccountService) {
        this.blackAccountService = blackAccountService;
    }

    @ApiOperation("黑号查询")
    @GetMapping(value = "/search")
    @Login(needToken = false)
    public Result<BlackAccountVO> search(BlackAccountSearchDTO dto) {
        BlackAccountVO result = blackAccountService.searchBlackAccount(dto);
        return Result.success(result);
    }
}
